package com.oocl.euc.core.common;

import com.oocl.euc.authentication.core.SSOUserContext;
import com.oocl.euc.authentication.core.UserInfo;
import com.oocl.euc.common.utils.UserContextHolder;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;

@Ignore
@RunWith(SpringRunner.class)
@SpringBootTest
@ActiveProfiles("test")
public class ITTestBase {
    @Autowired public WebApplicationContext wac;
    protected MockMvc mockMvc;

    @Before
    public void init() {
        mockMvc = MockMvcBuilders.webAppContextSetup(wac).build();
        mockUserContext();

    }
    private void mockUserContext() {
        SSOUserContext userContext = new SSOUserContext();
        UserInfo userInfo = new UserInfo();
        userInfo.setId("0000224774");
        userContext.setUserInfo(userInfo);
        UserContextHolder.setUserContext(userContext);
    }
}
